package com.lzh.runke.core.entity.validator;

import com.lzh.runke.core.entity.BaseEntity;
import com.lzh.runke.core.entity.validator.annotation.NestedIdNotBlank;
import org.apache.commons.lang3.StringUtils;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author LiuZiHao
 * @date 创建时间:2023年07月24日 11:07:08
 */
public class NestedIdNotBlankValidator implements ConstraintValidator<NestedIdNotBlank, BaseEntity> {
    @Override
    public boolean isValid(BaseEntity baseEntity, ConstraintValidatorContext constraintValidatorContext) {
        if (null == baseEntity) {
            return true;
        }
        return StringUtils.isNotBlank(baseEntity.getId());
    }
}
